import com.alibaba.druid.pool.DruidDataSource;

import java.sql.SQLException;

public class Main {
    public static void main(String[] args) {

        //创建Durid数据源
        DruidDataSource druidDataSource = new DruidDataSource();
        druidDataSource.setUrl("jdbc:mysql://localhost:3306/test");
        druidDataSource.setUsername("root");
        druidDataSource.setPassword("3141");
        druidDataSource.setDriverClassName("com.mysql.jdbc.Driver");
        try {
            if(druidDataSource.getConnection()!=null)


        System.out.println("连接成功");
        else
        System.out.println("连接失败");

        } catch (SQLException e) {
            throw new RuntimeException(e);
        }






        ;
    }
}